<?php

use yii\helpers\Html;
use yii\grid\GridView;
use yii\bootstrap\Modal;

/* @var $this yii\web\View */
/* @var $searchModel app\models\UserSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */

$this->title = Yii::t('app', 'Users');
$this->params['breadcrumbs'][] = $this->title;
?>
<script src="/kendoui/js/kendo.web.min.js"></script>
<script>
    $(document).ready(function() {
        $('#modalButton').click(function (){
            $('#modal').modal('show')
                .find('#modalContent')
                .load($(this).attr('value'));
        });
    });
</script>

<?php
Modal::begin([
    'id' => 'modal'
]);

echo "<div id='modalContent'></div>";

Modal::end();
?>

<div class="user-index">

    <h1><?= Html::encode($this->title) ?></h1>
    <?php // echo $this->render('_search', ['model' => $searchModel]); ?>

    <p>
        <?= Html::a(Yii::t('app', 'Create {modelClass}', [
    'modelClass' => 'User',
]), ['create'], ['class' => 'btn btn-success']) ?>
    </p>
    <?= Html::button(
        'create',
        ['value' => '/user/create',
            'id' => 'modalButton'

        ]) ?>


    <?= GridView::widget([
        'dataProvider' => $dataProvider,
        'filterModel' => $searchModel,
        'columns' => [
            ['class' => 'yii\grid\SerialColumn'],

            'id',
            'username',
            'password',
            'first_name',
            'last_name',
            // 'full_name',

            ['class' => 'yii\grid\ActionColumn'],
        ],
    ]); ?>

</div>
